#ifndef _RAY
#define _RAY

// INCLUDES --------------------------------------------------------------------
#include "Base.h"
#include "Vector4.h"

// DEFINES ---------------------------------------------------------------------

// TYPEDEFS --------------------------------------------------------------------
typedef struct
{
  union
  {
    // origin, direction
    Vector4 o, d; // component style
    Vector4 c[2]; // array style
  };
} Ray;

// FUNCTIONS -------------------------------------------------------------------

/* GENERAL:
   d    -> destination
   s    -> source
   size -> array size (0,1 for single elements)

   r    -> arbitrary ray
   t    -> floating point scalar
*/
void RayClear(Ray *r, ui32 size);         // clear to o:[0,0,0,1], d:[0,0,-1,1]
void RayCopy (Ray *d, Ray *s, ui32 size); // clone ray src->dest

// retrieve an arbitrary point p on the line produced by scalar t
void RayPoint(Vector4* d, Ray* r, fp t);

#endif // _RAY
